home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / FLI106C.ZIP;1 / BLSCROLL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-12  |  4.3 KB  |  282 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.06c
  4. // Copyright (C) 1990, 1991, 1992
  5. // Software Dimensions
  6. //
  7. // BlazeClass
  8. //
  9.  
  10. #ifndef __BCPLUSPLUS__
  11. #pragma inline
  12. #endif
  13.  
  14. #include "fli.h"
  15.  
  16. #ifdef __BCPLUSPLUS__
  17. #pragma hdrstop
  18. #endif
  19.  
  20. #define I asm
  21.  
  22. #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  23. #define ISFAR
  24. #endif
  25.  
  26. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  27. //
  28. // ScrollUp()
  29. //
  30. // Scrolls a region upward
  31. //
  32. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  33.  
  34. void BlazeClass::ScrollUp(int X,int Y,int Width,int Height)
  35. {
  36.   if (Width<2 || Height<2)
  37.     return;
  38.  
  39.   int ScreenWidth = BlazeClass::QuickWidth;
  40.   int Locator = (Y*ScreenWidth)+(X*2);
  41.  
  42.   void far *OUTPUT=BlazeClass::OUTPUT;
  43.   I les di,OUTPUT
  44.  
  45.   _DI += Locator;
  46.  
  47.   I mov bx,[Width]
  48.   I mov dx,[Height]
  49.   I dec dx
  50.  
  51.   I mov ax,es
  52.   I push ds
  53.   I mov ds,ax
  54.   I mov si,di
  55.   I add si,ScreenWidth
  56.   I cld
  57.  
  58. looped:
  59.  
  60.   I push di
  61.   I push si
  62.   I mov cx,bx
  63.   I rep movsw
  64.   I pop si
  65.   I pop di
  66.   I add si,ScreenWidth
  67.   I add di,ScreenWidth
  68.   I dec dx
  69.   I or dx,dx
  70.   I jne looped
  71.  
  72.   I pop ds
  73. }
  74.  
  75. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  76. //
  77. // ScrollDown()
  78. //
  79. // Scrolls a region downward
  80. //
  81. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.  
  83. void BlazeClass::ScrollDown(int X,int Y,int Width,int Height)
  84. {
  85.   if (Width<2 || Height<2)
  86.     return;
  87.  
  88.   int ScreenWidth = BlazeClass::QuickWidth;
  89.   int Locator = ((Y+Height-1)*ScreenWidth)+(X*2);
  90.  
  91.   void far *OUTPUT=BlazeClass::OUTPUT;
  92.   I les di,OUTPUT
  93.  
  94.   _DI += Locator;
  95.  
  96.   I mov bx,[Width]
  97.   I mov dx,[Height]
  98.   I dec dx
  99.  
  100.   I push ds
  101.   I mov ax,es
  102.   I mov ds,ax
  103.   I mov si,di
  104.   I sub si,ScreenWidth
  105.   I cld
  106.  
  107. looped:
  108.  
  109.   I push di
  110.   I push si
  111.   I mov cx,bx
  112.   I rep movsw
  113.   I pop si
  114.   I pop di
  115.   I sub si,ScreenWidth
  116.   I sub di,ScreenWidth
  117.   I dec dx
  118.   I or dx,dx
  119.   I jne looped
  120.  
  121.   I pop ds
  122. }
  123.  
  124. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  125. //
  126. // ScrollLeft()
  127. //
  128. // Scrolls a region leftward
  129. //
  130. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.  
  132. void BlazeClass::ScrollLeft(int X,int Y,int Width,int Height)
  133. {
  134.   if (Width<2 || Height<2)
  135.     return;
  136.  
  137.   I push ds
  138.  
  139.   int ScreenWidth = BlazeClass::QuickWidth;
  140.   int Locator = (Y*ScreenWidth)+(X*2);
  141.  
  142.   void far *OUTPUT=BlazeClass::OUTPUT;
  143.   I lds si,OUTPUT
  144.   I les di,OUTPUT
  145.  
  146.   _CX = Locator;
  147.   _DI += _CX;
  148.   _SI += (_CX+2);
  149.  
  150.   I push di
  151.  
  152.   I mov bx,[Width]
  153.   I dec bx
  154.   I mov dx,[Height]
  155.  
  156.   I cld
  157.  
  158. looped:
  159.  
  160.   I push di
  161.   I push si
  162.   I mov cx,bx
  163.   I rep movsw
  164.   I pop si
  165.   I pop di
  166.   I add si,ScreenWidth
  167.   I add di,ScreenWidth
  168.   I dec dx
  169.   I or dx,dx
  170.   I jne looped
  171.  
  172.   I pop di
  173.   I pop ds
  174.  
  175.   I dec word ptr Width
  176.   I add di,Width
  177.   I add di,Width
  178.  
  179.   ScreenWidth-=2;
  180.  
  181.   I cld
  182.   I mov al,32
  183.  
  184.   #ifdef ISFAR
  185.     I push es
  186.   #endif
  187.  
  188.   _AH=Color;
  189.  
  190.   #ifdef ISFAR
  191.     I pop es
  192.   #endif
  193.  
  194.   I mov cx,Height
  195.  
  196. again:
  197.  
  198.   I stosw
  199.   I add di,ScreenWidth
  200.   I loop again
  201. }
  202.  
  203. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  204. //
  205. // ScrollRight()
  206. //
  207. // Scrolls a region rightward
  208. //
  209. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  210.  
  211. void BlazeClass::ScrollRight(int X,int Y,int Width,int Height)
  212. {
  213.   if (Width<2 || Height<2)
  214.     return;
  215.  
  216.   I push ds
  217.  
  218.   int ScreenWidth = BlazeClass::QuickWidth;
  219.   int Locator = (Y*ScreenWidth)+((X+Width-1)*2);
  220.  
  221.   void far *OUTPUT=BlazeClass::OUTPUT;
  222.   I lds si,OUTPUT
  223.   I les di,OUTPUT
  224.  
  225.   _CX = Locator;
  226.   _DI += _CX;
  227.   _SI += (_CX-2);
  228.  
  229.   I push di
  230.  
  231.   I mov bx,[Width]
  232.   I dec bx
  233.   I mov dx,[Height]
  234.  
  235.   I std
  236.  
  237. looped:
  238.  
  239.   I push di
  240.   I push si
  241.   I mov cx,bx
  242.   I rep movsw
  243.   I pop si
  244.   I pop di
  245.   I add si,ScreenWidth
  246.   I add di,ScreenWidth
  247.   I dec dx
  248.   I or dx,dx
  249.   I jne looped
  250.  
  251.   I pop di
  252.   I pop ds
  253.  
  254.   I dec word ptr Width
  255.   I sub di,Width
  256.   I sub di,Width
  257.  
  258.   ScreenWidth-=2;
  259.  
  260.   I cld
  261.   I mov al,32
  262.  
  263.   #ifdef ISFAR
  264.     I push es
  265.   #endif
  266.  
  267.   _AH=Color;
  268.  
  269.   #ifdef ISFAR
  270.     I pop es
  271.   #endif
  272.  
  273.   I mov cx,Height
  274.  
  275. again:
  276.  
  277.   I stosw
  278.   I add di,ScreenWidth
  279.   I loop again
  280. }
  281.  
  282.